package com.financing.platform.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.financing.platform.dao.ISMSADDao;
import com.financing.platform.dto.SMSADDTO;
import com.financing.platform.service.ISMSADService;

/**
 * 
 * @ClassName: SMSAdServiceImpl
 * @Description: 短信广告模块 
 * @author  qiye
 * @date 2015年4月7日 下午4:18:42
 *
 */
@Service("sMSAdServiceImpl")
public class SMSAdServiceImpl extends BaseServiceImpl implements ISMSADService {

	@Autowired
	private ISMSADDao sMSADDaoImpl;
	
	@Override
	public List<SMSADDTO> listSmsAd() throws Exception {
		return sMSADDaoImpl.listSmsAd(null);
	}

	@Override
	public int updateSmsAd(SMSADDTO smsAdDTO) throws Exception {
		sMSADDaoImpl.deleteSmsAd(smsAdDTO.getId());
		return sMSADDaoImpl.addSmsAd(smsAdDTO);
	}

	@Override
	public String getSmsAd(String smsType) throws Exception {
		SMSADDTO  smsAdDTO = new SMSADDTO();
		smsAdDTO.setSmsType(smsType);
		smsAdDTO = sMSADDaoImpl.querySMSAdInfo(smsAdDTO);
		if(smsAdDTO != null){
			return smsAdDTO.getSmsContent();
		}
		return null;
	}
}
